/*************************************************************************
	> File Name: P1135.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-01-16 14:59:31
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 200

int to[MAX_N + 5];
int dis[MAX_N + 5];

void dfs(int k, int a, int n) {
    if (dis[a] <= k) return ;
    dis[a] = k;
    if (a + to[a] <= n) dfs(k + 1, a + to[a], n);
    if (a - to[a] >= 1) dfs(k + 1, a - to[a], n);
    return ;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++) {
        cin >> to[i];
    }
    for (int i = 1; i <= n; i++) dis[i] = n + 1;
    dfs(0, a, n);
    cout << (dis[b] == n + 1 ? -1 : dis[b]) << endl;
    return 0;
}
